package org.flexthinker.binding.ui.form.binding.flex
{
    import org.flexthinker.binding.ui.form.binding.BinderFactory;
    import org.hamcrest.assertThat;
    import org.hamcrest.core.isA;
    import org.hamcrest.object.instanceOf;

    import spark.components.ComboBox;

    import spark.components.Label;
    import spark.components.List;
    import spark.components.RichEditableText;
    import spark.components.RichText;
    import spark.components.TextArea;
    import spark.components.TextInput;

    public class DefaultFlexBinderFactoryTest
    {
        private var factory:BinderFactory;

        public function DefaultFlexBinderFactoryTest()
        {
        }

        [Before]
        public function setUp():void
        {
            factory = new DefaultFlexBinderFactory();
        }

        [Test]
        public function testLabel():void
        {
            var lbl:Label = new Label();
            assertThat(factory.getBinder( lbl,  "simpleString"), isA(instanceOf(TextBinder) ) );
        }
        [Test]
        public function testTextInput():void
        {
            var txt:TextInput = new TextInput();
            assertThat(factory.getBinder( txt,  "simpleString"), isA(instanceOf(TextBinder) ) );
        }


        [Test]
        public function testTextArea():void
        {
            var txt:TextArea = new TextArea();
            assertThat(factory.getBinder( txt,  "simpleString"), isA(instanceOf(TextBinder) ) );
        }

        [Test]
        public function testRichText():void
        {
            var txt:RichText = new RichText();
            assertThat(factory.getBinder( txt,  "simpleString"), isA(instanceOf(TextBinder) ) );
        }

        [Test]
        public function testRichEditableText():void
        {
            var txt:RichEditableText = new RichEditableText();
            assertThat(factory.getBinder( txt,  "simpleString"), isA(instanceOf(TextBinder) ) );
        }

        [Test]
        public function testComboBox():void
        {
            var cmb:ComboBox = new ComboBox();
            assertThat(factory.getBinder(cmb,  "simpleString"), isA(instanceOf(ListBinder)));
        }

        [Test]
        public function testList():void
        {
            var list:List = new List();
            assertThat(factory.getBinder(list,  "simpleString"), isA(instanceOf(ListBinder)));
        }


    }
}
